package com.isunland.managesystem.adapter;

import android.content.Context;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BaseListAdapter;
import com.isunland.managesystem.entity.CheckedOffList;
import com.isunland.managesystem.ui.CheckListFragment;
import java.util.HashMap;
import java.util.List;

/**
 * Created by wu on 2016/4/8.
 * 调休
 */
//public class CheckedOffAdapter extends ArrayAdapter<CheckedOffList.ListContent> {
public class CheckedOffAdapter extends BaseListAdapter<CheckedOffList.ListContent> {
  public CheckedOffAdapter(Context context, List<CheckedOffList.ListContent> objects) {
    super(context, objects);
  }

  @Override public void bindData(int position, ViewHolder vh, CheckedOffList.ListContent item) {

    vh.mTitleOneTv.setText(getContext().getResources().getString(R.string.offReason));
    vh.mTitleTwoTv.setText(getContext().getResources().getString(R.string.offType));
    vh.mTitleThreeTv.setText(getContext().getResources().getString(R.string.addOffDays));
    vh.mContentOneTv.setText(item.getHolyDesc());
    HashMap<String, String> map = CheckListFragment.mapOffType;
    String kindName = map.get(item.getHolyKindCode());
    vh.mContentTwoTv.setText(kindName);
    vh.mContentThreeTv.setText(item.getHolyDays());
  }

  /**
   * ViewHolder class for layout.<br />
   * <br />
   * Auto-created on 2015-07-27 17:04:41 by Android Layout Finder
   * (http://www.buzzingandroid.com/tools/android-layout-finder)
   */
  //    private static class ViewHolder {
  //        public final RelativeLayout rootView;
  //        public final TextView tvContent;
  //        public final TextView tvDeptName;
  //        public final TextView tvPhoneNumber;
  //        public final ImageView ivCall;
  //
  //        private ViewHolder(RelativeLayout rootView, TextView tvContent,TextView tvDeptName, TextView tvPhoneNumber, ImageView ivCall) {
  //            this.rootView = rootView;
  //            this.tvContent = tvContent;
  //            this.tvDeptName = tvDeptName;
  //            this.tvPhoneNumber = tvPhoneNumber;
  //            this.ivCall = ivCall;
  //        }
  //
  //        public static ViewHolder create(RelativeLayout rootView) {
  //            TextView tvContent = (TextView)rootView.findViewById( R.id.tv_name_contacts );
  //            TextView tvDeptName = (TextView)rootView.findViewById( R.id.tv_deptName_contacts );
  //            TextView tvPhoneNumber = (TextView)rootView.findViewById( R.id.tv_phoneNumber_contacts );
  //            ImageView ivCall = (ImageView)rootView.findViewById( R.id.iv_call_contacts );
  //            return new ViewHolder( rootView, tvContent,tvDeptName, tvPhoneNumber, ivCall );
  //        }
  //    }
  //
  //    @Override
  //    public View getView(int position, View convertView, ViewGroup parent) {
  //        final ViewHolder vh;
  //        if ( convertView == null ) {
  //            View widget = mInflater.inflate( R.layout.adapter_contact, parent, false );
  //            vh = ViewHolder.create( (RelativeLayout)widget );
  //            widget.setTag( vh );
  //        } else {
  //            vh = (ViewHolder)convertView.getTag();
  //        }
  //
  //        CheckedOffList.ListContent item = getItem( position );
  //
  //        vh.ivCall.setVisibility(View.GONE);
  //        vh.tvContent.setText(item.getHolyDesc());
  //        vh.tvContent.setSingleLine(true);
  //        HashMap<String,String> map= CheckListFragment.mapOffType;
  //        String kindName=map.get(item.getHolyKindCode());
  //        vh.tvDeptName.setText(kindName);
  //        LogUtil.i("调休类型====="+kindName);
  //        vh.tvPhoneNumber.setText(item.getHolyDays());
  //        return vh.rootView;
  //
  //    }
  //
  //    private LayoutInflater mInflater;
  //
  //    // Constructors
  //    public CheckedOffAdapter(Context context, List<CheckedOffList.ListContent> objects) {
  //        super(context, 0, objects);
  //        this.mInflater = LayoutInflater.from( context );
  //    }
  //    public CheckedOffAdapter(Context context, CheckedOffList.ListContent[] objects) {
  //        super(context, 0, objects);
  //        this.mInflater = LayoutInflater.from( context );
  //    }
}
